package com.kuang.pay.service;

import com.kuang.bascic.service.BaseServiceImpl;
import com.kuang.bascic.utils.AlipayUtils;
import com.kuang.order.domain.Paybill;
import com.kuang.pay.constant.PayAway;
import com.kuang.pay.domian.AlipayInfo;
import com.kuang.pay.mapper.AlipayInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.AccessType;
import org.springframework.stereotype.Service;
@Service
public class IpayServiceImpl extends BaseServiceImpl<AlipayInfo> implements IpayService {
    @Autowired
    private AlipayInfoMapper alipayInfoMapper;
    @Override
    public String pay(Paybill paybill, AlipayInfo alipayInfo) {
        // 封装支付方式
        switch (paybill.getPayChannel()){
            case PayAway.ALIPAY:
                // 调用阿里支付
                // 返回一个支付信息 以html方式
                return AlipayUtils.alipay(paybill,alipayInfo);
            case  PayAway.WXPAY:
                break;
            case  PayAway.YLPAY:
                break;
        }
        return null;
    }
}
